<?php
// +----------------------------------------------------------------------
// | B5LaravelCMF
// +----------------------------------------------------------------------
// | Author: 李恒 <357145480@qq.com>
// +----------------------------------------------------------------------
namespace App\Validates\Wall;

use App\Validates\ValidateBase;

class WallValidate extends ValidateBase
{
    public function rules()
    {
        return [
            'title' => 'required|min:2|max:90',
            'password' => 'required'
        ];
    }

    public function attributes()
    {
        return [
            'title' => '活动标题',
            'password' => '大屏密码'
        ];
    }

    /**
     * 跳转类型处理
     * @return ValidateBase
     */
    protected function before_validate()
    {

        $this->data['bgimg']=$this->data['bgimg']??[];
        $this->data['logoimg']=$this->data['logoimg']??[];
        if(is_array($this->data['bgimg'])){
            $this->data['bgimg']=$this->data['bgimg'][0]??'';
        }
        if(is_array($this->data['logoimg'])){
            $this->data['logoimg']=$this->data['logoimg'][0]??'';
        }
        return parent::before_validate(); // TODO: Change the autogenerated stub
    }
}
